package com.xiaoluo.a23_visibility;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class MainActivity extends AppCompatActivity {

    public static final int VISIBLE = 0x00000000;
    public static final int INVISIBLE = 0x00000004;
    public static final int GONE = 0x00000008;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        LinearLayout parentLayout = findViewById(R.id.parentLayout);
        parentLayout.getParent();
        final Button changeBtn = findViewById(R.id.change);
        Button visibleBtn = findViewById(R.id.getVisible);
        final ImageView imageView = findViewById(R.id.imageView);
        final FrameLayout layout = findViewById(R.id.layout);
        changeBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                layout.setVisibility(layout.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE);
            }
        });
        visibleBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int value = imageView.getVisibility();
                Log.i("xlj1117", "onClick: value = " + value);
            }
        });
    }
}
